package site.marqstree.kotlin.library.good.ui.activity.goodlist.recyclerview

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.chad.library.adapter.base.loadmore.BaseLoadMoreView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import site.marqstree.kotlin.library.good.R


/*
 * 项目名: KotlinMall
 * 包名: site.marqstree.kotlin.library.good.ui.fragment.goodlist.recyclerview
 * 文件名: CustomLoadMoreView
 * 创建者: marqstree
 * 创建时间: 2020/3/8 17:02
 * 描述: TODO
 */
//自定义页脚视图
class CustomLoadMoreView : BaseLoadMoreView() {
    //加载整个页脚视图
    override fun getRootView(parent: ViewGroup): View {
        return LayoutInflater.from(parent.context)
            .inflate(R.layout.view_load_more, parent, false)
    }

    // 布局中 “加载中”的View
    override fun getLoadingView(holder: BaseViewHolder): View {
        return holder.getView(R.id.load_more_loading_view)
    }

    // 布局中 “当前一页加载完成”的View
    override fun getLoadComplete(holder: BaseViewHolder): View {
        return holder.getView(R.id.load_more_load_complete_view)
    }

    // 布局中 “全部加载结束，没有数据”的View
    override fun getLoadEndView(holder: BaseViewHolder): View {
        return holder.getView(R.id.load_more_load_end_view)
    }

    // 布局中 “加载失败”的View
    override fun getLoadFailView(holder: BaseViewHolder): View {
        return holder.getView(R.id.load_more_load_fail_view)
    }
}